package com.exam.common;

import com.google.common.base.Strings;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

public class BaseController {

    public Map<String, Object> reqParams(HttpServletRequest request){
        Enumeration<String> names = request.getParameterNames();
        Map<String, Object> map = new HashMap<String, Object>();

        while (names.hasMoreElements()) {
            String name = names.nextElement();
            String value = request.getParameter(name);

            if (!Strings.isNullOrEmpty(name)) {
                map.put(name, value);
            }
        }
        return map;
    }
}
